package com.tuweiya.frontbackseparation.fbsBack.controller;

import com.tuweiya.frontbackseparation.fbsBack.entity.UserEntity;
import com.tuweiya.frontbackseparation.fbsBack.service.UserService;
import com.tuweiya.study.utils.HelloUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/hello")
@Api(tags = "HelloController")
public class HelloController {

    @Autowired
    private UserService userService;

    @ApiOperation(value = "测试")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "姓名", paramType = "query", required = true)
    })
    @GetMapping(value = "/sayHello")
    public String sayHello(String name) {
        return "Hello " + HelloUtils.upperStr(name);
    }

    @GetMapping(value = "/saveOne")
    public Long saveOne(String name, String password, Long address) {
        return userService.saveOne(name, password, address);
    }
}
